package com.config.exception;

import com.utils.R;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.*;

/**
 * 统一异常处理类
 */
@Component
@RestControllerAdvice
public class ServiceExceptionHandler {

    /**
     * 捕获ServiceException
     * @param e
     * @return
     */
    @ExceptionHandler(BussServiceException.class)
    public R serviceExceptionHandler(BussServiceException e) {
        return R.error(e.getCode(), e.getMsg());
    }

}
